<template>
  <div class="common-body-wrapper">
    <search-header single-width="120" :searchList="searchList" @changeHeight="toRetTable" @confirmSearch="toSearch" :isNeedTree="true" :isCheckbox="true" :paramName="paramName" @setSelectedNode="setSelectedNode"></search-header>
    <multi-fun-table :sortColumn='notFormatColumn' :orderType='sortType' :fixed-cols="fixedCols" :is-reset-table="isResetTable" :theads-info="theadsInfo" :tbodys-info="tbodysInfo" @handleMultiCheck="handleMultiCheck" @handleSortColumn="handleSortColumn" @searchFn="getList" @getNextPage="getNextPage">
      <div class="operate-btn-group" slot="operateBtnGroup">
        <a class="ake_btn ake_btn_text" v-if="isPermmited('TRADER_COUPON:COUPON:GRANT:EXPORT')" @click.prevent="exportData()">导出</a>
      </div>
      <template slot="tdCell" slot-scope="props">
        <el-table-column :fixed="props.fixed" :label="props.label" :min-width="props.minWidth" :width="props.width" :prop="props.prop" :sortable="props.sortable">
          <template slot-scope="scope">
            <span v-if="'reno' == props.prop">{{scope.$index+1}}</span>
            <span v-else-if="'enterCarImg' == props.prop">
              <a class="imgLink" @click="showBigImgModal('bigPicModal', scope.row['carImageUrl'])">查看</a>
            </span>
            <span v-else>{{ scope.row[props.prop] }}</span>
          </template>
        </el-table-column>
      </template>
    </multi-fun-table>

    <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
    <big-pic-modal ref="bigPicModal">
      <img slot="bigImgSlot" :src="bigImgPath | setImgPath" alt="" @error="imgError('../../', 'car', $event)">
    </big-pic-modal>
  </div>
</template>

<script>
import common from '@mixins/common.js'
import stardardList from '@mixins/tables/stardardList.js'

//modal
import invokeModal from '@mixins/modal/invokeModal.js'
import BigPicModal from '@components/widgets/BigPicModal.vue'

// image
import images from '@mixins/image.js'

// 引进vue的js
import grant from './js/grant.js'
export default {
  name: 'cGrant',
  mixins: [common, stardardList, invokeModal, images, grant],
  components: {
    BigPicModal
  },
  data() {
    const today = [new Date(moment().format('YYYY-MM-DD 00:00:00')), new Date(moment().format('YYYY-MM-DD 23:59:59'))];
    return {
      paramName: 'query_parkId',
      fixedCols: 3,
      total: 0,
      //prop-返回数据的字段名称   proisNotInter:true,pNameisNotInter:true,，name-查询字段传参名称    text-显示名称  //initHidden  初始化不显示
      searchList: [
        { type: 'datePicker', isShow: false,name: 'query_time', text: '发放时间', propName: 'beginTime,endTime', value: today, style: { width: '360px' } },
        { type: 'text', isShow: false,name: 'serialNumber', text: '优惠券编码', value: '' },
        { type: 'text', isShow: false,name: 'couponName', text: '优惠券名称', value: '' },
        { type: 'text', isShow: false,name: 'carCode', text: '车牌号', value: '' },
        { type: 'text', isShow: false,name: 'cardCode', text: '卡票号', value: '' },
        { type: 'text', isShow: false,name: 'traderName', text: '发放商家', value: '' },

        {
          type: 'select', isShow: false,name: 'couponType', text: '类型', value: '', options: [
            { name: '全部', value: '' },
            { name: '免费券', value: '0' },
            { name: '金额扣减券', value: '1' },
            { name: '金额折扣券', value: '2' },
            { name: '金额固定值券', value: '3' },
            { name: '时间券', value: '4' },
          ]
        },
      ],
      theadsInfo: [
        // { index: 0, isShow: false, prop: 'reno', text: '序号', width: 64 },
        { index: 1, isShow: false, prop: 'sellName', text: '优惠券名称', sortable: true, minWidth: 50 },
        { index: 2, isShow: false, prop: 'code', text: '优惠券代码', sortable: true, minWidth: 60, initHidden: true },
        { index: 3, isShow: false, prop: 'serialNumber', text: '优惠券编码', sortable: true, minWidth: 60, initHidden: true },
        { index: 4, isShow: false, prop: 'couponTypeStr', text: '优惠券类型', sortable: true},
        { index: 5, isShow: false, prop: 'faceValue', text: '优惠券面值(元)', sortable: true, minWidth: 50 },
        { index: 6, isShow: false, prop: 'traderName', text: '发放商家名称', sortable: true, minWidth: 50 },
        { index: 7, isShow: false, prop: 'grantTime', text: '发放时间', sortable: true, minWidth: 80 },
        { index: 8, isShow: false, prop: 'validTo', text: '过期时间', sortable: true, minWidth: 80 },
        { index: 9, isShow: false, prop: 'carCode', text: '车牌号', sortable: true, minWidth: 60 },
        { index: 10, isShow: false, prop: 'cardCode', text: '卡票号', sortable: true, minWidth: 60, initHidden: true },

      ],
      tbodysInfo: []
    }
  },
  methods: {
  }
}
</script>

<style lang="less" scoped>

</style>
